<template>
    个人设置页
    <div>
        手机号 <input type="text" placeholder="请输入你的手机号">
    </div>
    <div>
        <button @click="submit">提交</button>
    </div>
</template>

<script setup>
import { ref } from "vue";
import {useRouter} from 'vue-router'
 import {useStore} from 'vuex'

//  拿到路由的实例化对象
const router = useRouter()
// 拿到Vuex的实例化对象
const store = useStore

const phone = ref('')

const submit = ()=>{
    // 更新用户信息
   store.commit("updateUserInFo",{
      ...store.state.userInFo,//将原来的用户信息解构出来
    name:'张三',
        gender:'男',
        phone:'12345678900',
        phone
   })
   alert("修改成功")
   router.push("/user/profile")
}
</script>